'\" t
.\"     Title: git
.\"    Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\"      Date: 03/31/2015
.\"    Manual: Git Manual
.\"    Source: Git 2.3.5
.\"  Language: English; Simplified Chinese
.\"
.TH "GIT" "1" "03/31/2015" "Git 2\&.3\&.5" "Git 使用手册"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git \- 笨拙的内容追踪系统
.SH "SYNOPSIS"
.sp
.nf
\fIgit\fR [\-\-version] [\-\-help] [\-C <path>] [\-c <name>=<value>]
    [\-\-exec\-path[=<path>]] [\-\-html\-path] [\-\-man\-path] [\-\-info\-path]
    [\-p|\-\-paginate|\-\-no\-pager] [\-\-no\-replace\-objects] [\-\-bare]
    [\-\-git\-dir=<path>] [\-\-work\-tree=<path>] [\-\-namespace=<name>]
    <command> [<args>]
.fi
.sp
.SH "描述 (DESCRIPTION)"
.sp
Git 是一个快速又富有伸缩性的分布式版本控制系统。 它具有十分丰富的指令集, 既可以提供高级操作, 也提供底层的完整控制接口。
.sp
请查看 \fBgittutorial\fR(7) 以入门, 然后请查看 \fBgiteveryday\fR(7) 以获取实用的最小命令集合。 \m[blue]\fBGit User\(cqs Manual\fR\m[]\&\s-2\u[1]\d\s+2 一文可作为更深入的介绍。
.sp
在你掌握了基础概念之后, 你可以返回本页面来了解 Git 提供哪些命令。 如需了解更多独立的 Git 命令, 请使用
"git help command"。 \fBgitcli\fR(7) 手册页提供对 Git 命令行语法的概述。
.sp
格式化并附有超链接的最新版本 Git 文档可以在如下页面找到：
\fBhttp://git\-htmldocs\&.googlecode\&.com/git/git\&.html\fR\&.
.SH "选项 (OPTIONS)"
.PP
\-\-version
.RS 4
打印
\fIgit\fR
程序所属 Git 套件的版本。
.RE
.PP
\-\-help
.RS 4
打印概要与一列最常用的命令列表。 如果同时给出了选项
\fI\-\-all\fR
或
\fI\-a\fR
, 则全部可用命令都将被列出。
如果给出了一个 Git 命令, 则该选项将打开对应命令的帮助手册页。
.sp
其它可用选项可用来控制帮助页面应当如何显示。 请查看
\fBgit-help\fR(1)
以了解更多信息, 因为
\fBgit \-\-help \&.\&.\&.\fR
会被内部转换成为
\fBgit help \&.\&.\&.\fR\&.
.RE
.PP
\-C <路径>
.RS 4
让 git 以
\fI<path>\fR
作为工作目录来执行。 如果有多个
\fB\-C\fR
选项被指定,
每一个相接的非绝对
\fB\-C <path>\fR
路径将被解释为相对于前一个
\fB\-C <path>\fR
的路径。
.sp
This option affects options that expect path name like
\fB\-\-git\-dir\fR
and
\fB\-\-work\-tree\fR
in that their interpretations of the path names would be made relative to the working directory caused by the
\fB\-C\fR
option\&. For example the following invocations are equivalent:
.sp
.if n \{\
.RS 4
.\}
.nf
git \-\-git\-dir=a\&.git \-\-work\-tree=b \-C c status
git \-\-git\-dir=c/a\&.git \-\-work\-tree=c/b status
.fi
.if n \{\
.RE
.\}
.RE
.PP
\-c <name>=<value>
.RS 4
Pass a configuration parameter to the command\&. The value given will override values from configuration files\&. The <name> is expected in the same format as listed by
\fIgit config\fR
(subkeys separated by dots)\&.
.sp
Note that omitting the
\fB=\fR
in
\fBgit \-c foo\&.bar \&.\&.\&.\fR
is allowed and sets
\fBfoo\&.bar\fR
to the boolean true value (just like
\fB[foo]bar\fR
would in a config file)\&. Including the equals but with an empty value (like
\fBgit \-c foo\&.bar= \&.\&.\&.\fR) sets
\fBfoo\&.bar\fR
to the empty string\&.
.RE
.PP
\-\-exec\-path[=<path>]
.RS 4
Path to wherever your core Git programs are installed\&. This can also be controlled by setting the GIT_EXEC_PATH environment variable\&. If no path is given,
\fIgit\fR
will print the current setting and then exit\&.
.RE
.PP
\-\-html\-path
.RS 4
Print the path, without trailing slash, where Git\(cqs HTML documentation is installed and exit\&.
.RE
.PP
\-\-man\-path
.RS 4
Print the manpath (see
\fBman(1)\fR) for the man pages for this version of Git and exit\&.
.RE
.PP
\-\-info\-path
.RS 4
Print the path where the Info files documenting this version of Git are installed and exit\&.
.RE
.PP
\-p, \-\-paginate
.RS 4
Pipe all output into
\fIless\fR
(or if set, $PAGER) if standard output is a terminal\&. This overrides the
\fBpager\&.<cmd>\fR
configuration options (see the "Configuration Mechanism" section below)\&.
.RE
.PP
\-\-no\-pager
.RS 4
Do not pipe Git output into a pager\&.
.RE
.PP
\-\-git\-dir=<path>
.RS 4
Set the path to the repository\&. This can also be controlled by setting the GIT_DIR environment variable\&. It can be an absolute path or relative path to current working directory\&.
.RE
.PP
\-\-work\-tree=<path>
.RS 4
Set the path to the working tree\&. It can be an absolute path or a path relative to the current working directory\&. This can also be controlled by setting the GIT_WORK_TREE environment variable and the core\&.worktree configuration variable (see core\&.worktree in
\fBgit-config\fR(1)
for a more detailed discussion)\&.
.RE
.PP
\-\-namespace=<path>
.RS 4
Set the Git namespace\&. See
\fBgitnamespaces\fR(7)
for more details\&. Equivalent to setting the
\fBGIT_NAMESPACE\fR
environment variable\&.
.RE
.PP
\-\-bare
.RS 4
Treat the repository as a bare repository\&. If GIT_DIR environment is not set, it is set to the current working directory\&.
.RE
.PP
\-\-no\-replace\-objects
.RS 4
Do not use replacement refs to replace Git objects\&. See
\fBgit-replace\fR(1)
for more information\&.
.RE
.PP
\-\-literal\-pathspecs
.RS 4
Treat pathspecs literally (i\&.e\&. no globbing, no pathspec magic)\&. This is equivalent to setting the
\fBGIT_LITERAL_PATHSPECS\fR
environment variable to
\fB1\fR\&.
.RE
.PP
\-\-glob\-pathspecs
.RS 4
Add "glob" magic to all pathspec\&. This is equivalent to setting the
\fBGIT_GLOB_PATHSPECS\fR
environment variable to
\fB1\fR\&. Disabling globbing on individual pathspecs can be done using pathspec magic ":(literal)"
.RE
.PP
\-\-noglob\-pathspecs
.RS 4
Add "literal" magic to all pathspec\&. This is equivalent to setting the
\fBGIT_NOGLOB_PATHSPECS\fR
environment variable to
\fB1\fR\&. Enabling globbing on individual pathspecs can be done using pathspec magic ":(glob)"
.RE
.PP
\-\-icase\-pathspecs
.RS 4
Add "icase" magic to all pathspec\&. This is equivalent to setting the
\fBGIT_ICASE_PATHSPECS\fR
environment variable to
\fB1\fR\&.
.RE
.SH "GIT命令 (GIT COMMANDS)"
.sp
我们将 Git 分为高级 ("porcelain") 命令与低级 ("plumbing") 命令。
.SH "高级命令 (HIGH-LEVEL COMMANDS (PORCELAIN))"
.sp
We separate the porcelain commands into the main commands and some ancillary user utilities\&.
.SS "Main porcelain commands"
.PP
\fBgit-add\fR(1)
.RS 4
Add file contents to the index\&.
.RE
.PP
\fBgit-am\fR(1)
.RS 4
Apply a series of patches from a mailbox\&.
.RE
.PP
\fBgit-archive\fR(1)
.RS 4
Create an archive of files from a named tree\&.
.RE
.PP
\fBgit-bisect\fR(1)
.RS 4
Find by binary search the change that introduced a bug\&.
.RE
.PP
\fBgit-branch\fR(1)
.RS 4
List, create, or delete branches\&.
.RE
.PP
\fBgit-bundle\fR(1)
.RS 4
Move objects and refs by archive\&.
.RE
.PP
\fBgit-checkout\fR(1)
.RS 4
Checkout a branch or paths to the working tree\&.
.RE
.PP
\fBgit-cherry-pick\fR(1)
.RS 4
Apply the changes introduced by some existing commits\&.
.RE
.PP
\fBgit-citool\fR(1)
.RS 4
Graphical alternative to git\-commit\&.
.RE
.PP
\fBgit-clean\fR(1)
.RS 4
Remove untracked files from the working tree\&.
.RE
.PP
\fBgit-clone\fR(1)
.RS 4
Clone a repository into a new directory\&.
.RE
.PP
\fBgit-commit\fR(1)
.RS 4
Record changes to the repository\&.
.RE
.PP
\fBgit-describe\fR(1)
.RS 4
Show the most recent tag that is reachable from a commit\&.
.RE
.PP
\fBgit-diff\fR(1)
.RS 4
Show changes between commits, commit and working tree, etc\&.
.RE
.PP
\fBgit-fetch\fR(1)
.RS 4
Download objects and refs from another repository\&.
.RE
.PP
\fBgit-format-patch\fR(1)
.RS 4
Prepare patches for e\-mail submission\&.
.RE
.PP
\fBgit-gc\fR(1)
.RS 4
Cleanup unnecessary files and optimize the local repository\&.
.RE
.PP
\fBgit-grep\fR(1)
.RS 4
Print lines matching a pattern\&.
.RE
.PP
\fBgit-gui\fR(1)
.RS 4
A portable graphical interface to Git\&.
.RE
.PP
\fBgit-init\fR(1)
.RS 4
Create an empty Git repository or reinitialize an existing one\&.
.RE
.PP
\fBgit-log\fR(1)
.RS 4
Show commit logs\&.
.RE
.PP
\fBgit-merge\fR(1)
.RS 4
Join two or more development histories together\&.
.RE
.PP
\fBgit-mv\fR(1)
.RS 4
Move or rename a file, a directory, or a symlink\&.
.RE
.PP
\fBgit-notes\fR(1)
.RS 4
Add or inspect object notes\&.
.RE
.PP
\fBgit-pull\fR(1)
.RS 4
Fetch from and integrate with another repository or a local branch\&.
.RE
.PP
\fBgit-push\fR(1)
.RS 4
Update remote refs along with associated objects\&.
.RE
.PP
\fBgit-rebase\fR(1)
.RS 4
Forward\-port local commits to the updated upstream head\&.
.RE
.PP
\fBgit-reset\fR(1)
.RS 4
Reset current HEAD to the specified state\&.
.RE
.PP
\fBgit-revert\fR(1)
.RS 4
Revert some existing commits\&.
.RE
.PP
\fBgit-rm\fR(1)
.RS 4
Remove files from the working tree and from the index\&.
.RE
.PP
\fBgit-shortlog\fR(1)
.RS 4
Summarize
\fIgit log\fR
output\&.
.RE
.PP
\fBgit-show\fR(1)
.RS 4
Show various types of objects\&.
.RE
.PP
\fBgit-stash\fR(1)
.RS 4
Stash the changes in a dirty working directory away\&.
.RE
.PP
\fBgit-status\fR(1)
.RS 4
Show the working tree status\&.
.RE
.PP
\fBgit-submodule\fR(1)
.RS 4
Initialize, update or inspect submodules\&.
.RE
.PP
\fBgit-tag\fR(1)
.RS 4
Create, list, delete or verify a tag object signed with GPG\&.
.RE
.PP
\fBgitk\fR(1)
.RS 4
The Git repository browser\&.
.RE
.SS "Ancillary Commands"
.sp
Manipulators:
.PP
\fBgit-config\fR(1)
.RS 4
Get and set repository or global options\&.
.RE
.PP
\fBgit-fast-export\fR(1)
.RS 4
Git data exporter\&.
.RE
.PP
\fBgit-fast-import\fR(1)
.RS 4
Backend for fast Git data importers\&.
.RE
.PP
\fBgit-filter-branch\fR(1)
.RS 4
Rewrite branches\&.
.RE
.PP
\fBgit-mergetool\fR(1)
.RS 4
Run merge conflict resolution tools to resolve merge conflicts\&.
.RE
.PP
\fBgit-pack-refs\fR(1)
.RS 4
Pack heads and tags for efficient repository access\&.
.RE
.PP
\fBgit-prune\fR(1)
.RS 4
Prune all unreachable objects from the object database\&.
.RE
.PP
\fBgit-reflog\fR(1)
.RS 4
Manage reflog information\&.
.RE
.PP
\fBgit-relink\fR(1)
.RS 4
Hardlink common objects in local repositories\&.
.RE
.PP
\fBgit-remote\fR(1)
.RS 4
Manage set of tracked repositories\&.
.RE
.PP
\fBgit-repack\fR(1)
.RS 4
Pack unpacked objects in a repository\&.
.RE
.PP
\fBgit-replace\fR(1)
.RS 4
Create, list, delete refs to replace objects\&.
.RE
.sp
Interrogators:
.PP
\fBgit-annotate\fR(1)
.RS 4
Annotate file lines with commit information\&.
.RE
.PP
\fBgit-blame\fR(1)
.RS 4
Show what revision and author last modified each line of a file\&.
.RE
.PP
\fBgit-cherry\fR(1)
.RS 4
Find commits yet to be applied to upstream\&.
.RE
.PP
\fBgit-count-objects\fR(1)
.RS 4
Count unpacked number of objects and their disk consumption\&.
.RE
.PP
\fBgit-difftool\fR(1)
.RS 4
Show changes using common diff tools\&.
.RE
.PP
\fBgit-fsck\fR(1)
.RS 4
Verifies the connectivity and validity of the objects in the database\&.
.RE
.PP
\fBgit-get-tar-commit-id\fR(1)
.RS 4
Extract commit ID from an archive created using git\-archive\&.
.RE
.PP
\fBgit-help\fR(1)
.RS 4
Display help information about Git\&.
.RE
.PP
\fBgit-instaweb\fR(1)
.RS 4
Instantly browse your working repository in gitweb\&.
.RE
.PP
\fBgit-merge-tree\fR(1)
.RS 4
Show three\-way merge without touching index\&.
.RE
.PP
\fBgit-rerere\fR(1)
.RS 4
Reuse recorded resolution of conflicted merges\&.
.RE
.PP
\fBgit-rev-parse\fR(1)
.RS 4
Pick out and massage parameters\&.
.RE
.PP
\fBgit-show-branch\fR(1)
.RS 4
Show branches and their commits\&.
.RE
.PP
\fBgit-verify-commit\fR(1)
.RS 4
Check the GPG signature of commits\&.
.RE
.PP
\fBgit-verify-tag\fR(1)
.RS 4
Check the GPG signature of tags\&.
.RE
.PP
\fBgit-whatchanged\fR(1)
.RS 4
Show logs with difference each commit introduces\&.
.RE
.PP
\fBgitweb\fR(1)
.RS 4
Git web interface (web frontend to Git repositories)\&.
.RE
.SS "Interacting with Others"
.sp
These commands are to interact with foreign SCM and with other people via patch over e\-mail\&.
.PP
\fBgit-archimport\fR(1)
.RS 4
Import an Arch repository into Git\&.
.RE
.PP
\fBgit-cvsexportcommit\fR(1)
.RS 4
Export a single commit to a CVS checkout\&.
.RE
.PP
\fBgit-cvsimport\fR(1)
.RS 4
Salvage your data out of another SCM people love to hate\&.
.RE
.PP
\fBgit-cvsserver\fR(1)
.RS 4
A CVS server emulator for Git\&.
.RE
.PP
\fBgit-imap-send\fR(1)
.RS 4
Send a collection of patches from stdin to an IMAP folder\&.
.RE
.PP
\fBgit-p4\fR(1)
.RS 4
Import from and submit to Perforce repositories\&.
.RE
.PP
\fBgit-quiltimport\fR(1)
.RS 4
Applies a quilt patchset onto the current branch\&.
.RE
.PP
\fBgit-request-pull\fR(1)
.RS 4
Generates a summary of pending changes\&.
.RE
.PP
\fBgit-send-email\fR(1)
.RS 4
Send a collection of patches as emails\&.
.RE
.PP
\fBgit-svn\fR(1)
.RS 4
Bidirectional operation between a Subversion repository and Git\&.
.RE
.SH "LOW-LEVEL COMMANDS (PLUMBING)"
.sp
Although Git includes its own porcelain layer, its low\-level commands are sufficient to support development of alternative porcelains\&. Developers of such porcelains might start by reading about \fBgit-update-index\fR(1) and \fBgit-read-tree\fR(1)\&.
.sp
The interface (input, output, set of options and the semantics) to these low\-level commands are meant to be a lot more stable than Porcelain level commands, because these commands are primarily for scripted use\&. The interface to Porcelain commands on the other hand are subject to change in order to improve the end user experience\&.
.sp
The following description divides the low\-level commands into commands that manipulate objects (in the repository, index, and working tree), commands that interrogate and compare objects, and commands that move objects and references between repositories\&.
.SS "Manipulation commands"
.PP
\fBgit-apply\fR(1)
.RS 4
Apply a patch to files and/or to the index\&.
.RE
.PP
\fBgit-checkout-index\fR(1)
.RS 4
Copy files from the index to the working tree\&.
.RE
.PP
\fBgit-commit-tree\fR(1)
.RS 4
Create a new commit object\&.
.RE
.PP
\fBgit-hash-object\fR(1)
.RS 4
Compute object ID and optionally creates a blob from a file\&.
.RE
.PP
\fBgit-index-pack\fR(1)
.RS 4
Build pack index file for an existing packed archive\&.
.RE
.PP
\fBgit-merge-file\fR(1)
.RS 4
Run a three\-way file merge\&.
.RE
.PP
\fBgit-merge-index\fR(1)
.RS 4
Run a merge for files needing merging\&.
.RE
.PP
\fBgit-mktag\fR(1)
.RS 4
Creates a tag object\&.
.RE
.PP
\fBgit-mktree\fR(1)
.RS 4
Build a tree\-object from ls\-tree formatted text\&.
.RE
.PP
\fBgit-pack-objects\fR(1)
.RS 4
Create a packed archive of objects\&.
.RE
.PP
\fBgit-prune-packed\fR(1)
.RS 4
Remove extra objects that are already in pack files\&.
.RE
.PP
\fBgit-read-tree\fR(1)
.RS 4
Reads tree information into the index\&.
.RE
.PP
\fBgit-symbolic-ref\fR(1)
.RS 4
Read, modify and delete symbolic refs\&.
.RE
.PP
\fBgit-unpack-objects\fR(1)
.RS 4
Unpack objects from a packed archive\&.
.RE
.PP
\fBgit-update-index\fR(1)
.RS 4
Register file contents in the working tree to the index\&.
.RE
.PP
\fBgit-update-ref\fR(1)
.RS 4
Update the object name stored in a ref safely\&.
.RE
.PP
\fBgit-write-tree\fR(1)
.RS 4
Create a tree object from the current index\&.
.RE
.SS "Interrogation commands"
.PP
\fBgit-cat-file\fR(1)
.RS 4
Provide content or type and size information for repository objects\&.
.RE
.PP
\fBgit-diff-files\fR(1)
.RS 4
Compares files in the working tree and the index\&.
.RE
.PP
\fBgit-diff-index\fR(1)
.RS 4
Compare a tree to the working tree or index\&.
.RE
.PP
\fBgit-diff-tree\fR(1)
.RS 4
Compares the content and mode of blobs found via two tree objects\&.
.RE
.PP
\fBgit-for-each-ref\fR(1)
.RS 4
Output information on each ref\&.
.RE
.PP
\fBgit-ls-files\fR(1)
.RS 4
Show information about files in the index and the working tree\&.
.RE
.PP
\fBgit-ls-remote\fR(1)
.RS 4
List references in a remote repository\&.
.RE
.PP
\fBgit-ls-tree\fR(1)
.RS 4
List the contents of a tree object\&.
.RE
.PP
\fBgit-merge-base\fR(1)
.RS 4
Find as good common ancestors as possible for a merge\&.
.RE
.PP
\fBgit-name-rev\fR(1)
.RS 4
Find symbolic names for given revs\&.
.RE
.PP
\fBgit-pack-redundant\fR(1)
.RS 4
Find redundant pack files\&.
.RE
.PP
\fBgit-rev-list\fR(1)
.RS 4
Lists commit objects in reverse chronological order\&.
.RE
.PP
\fBgit-show-index\fR(1)
.RS 4
Show packed archive index\&.
.RE
.PP
\fBgit-show-ref\fR(1)
.RS 4
List references in a local repository\&.
.RE
.PP
\fBgit-unpack-file\fR(1)
.RS 4
Creates a temporary file with a blob\(cqs contents\&.
.RE
.PP
\fBgit-var\fR(1)
.RS 4
Show a Git logical variable\&.
.RE
.PP
\fBgit-verify-pack\fR(1)
.RS 4
Validate packed Git archive files\&.
.RE
.sp
In general, the interrogate commands do not touch the files in the working tree\&.
.SS "Synching repositories"
.PP
\fBgit-daemon\fR(1)
.RS 4
A really simple server for Git repositories\&.
.RE
.PP
\fBgit-fetch-pack\fR(1)
.RS 4
Receive missing objects from another repository\&.
.RE
.PP
\fBgit-http-backend\fR(1)
.RS 4
Server side implementation of Git over HTTP\&.
.RE
.PP
\fBgit-send-pack\fR(1)
.RS 4
Push objects over Git protocol to another repository\&.
.RE
.PP
\fBgit-update-server-info\fR(1)
.RS 4
Update auxiliary info file to help dumb servers\&.
.RE
.sp
The following are helper commands used by the above; end users typically do not use them directly\&.
.PP
\fBgit-http-fetch\fR(1)
.RS 4
Download from a remote Git repository via HTTP\&.
.RE
.PP
\fBgit-http-push\fR(1)
.RS 4
Push objects over HTTP/DAV to another repository\&.
.RE
.PP
\fBgit-parse-remote\fR(1)
.RS 4
Routines to help parsing remote repository access parameters\&.
.RE
.PP
\fBgit-receive-pack\fR(1)
.RS 4
Receive what is pushed into the repository\&.
.RE
.PP
\fBgit-shell\fR(1)
.RS 4
Restricted login shell for Git\-only SSH access\&.
.RE
.PP
\fBgit-upload-archive\fR(1)
.RS 4
Send archive back to git\-archive\&.
.RE
.PP
\fBgit-upload-pack\fR(1)
.RS 4
Send objects packed back to git\-fetch\-pack\&.
.RE
.SS "Internal helper commands"
.sp
These are internal helper commands used by other commands; end users typically do not use them directly\&.
.PP
\fBgit-check-attr\fR(1)
.RS 4
Display gitattributes information\&.
.RE
.PP
\fBgit-check-ignore\fR(1)
.RS 4
Debug gitignore / exclude files\&.
.RE
.PP
\fBgit-check-mailmap\fR(1)
.RS 4
Show canonical names and email addresses of contacts\&.
.RE
.PP
\fBgit-check-ref-format\fR(1)
.RS 4
Ensures that a reference name is well formed\&.
.RE
.PP
\fBgit-column\fR(1)
.RS 4
Display data in columns\&.
.RE
.PP
\fBgit-credential\fR(1)
.RS 4
Retrieve and store user credentials\&.
.RE
.PP
\fBgit-credential-cache\fR(1)
.RS 4
Helper to temporarily store passwords in memory\&.
.RE
.PP
\fBgit-credential-store\fR(1)
.RS 4
Helper to store credentials on disk\&.
.RE
.PP
\fBgit-fmt-merge-msg\fR(1)
.RS 4
Produce a merge commit message\&.
.RE
.PP
\fBgit-interpret-trailers\fR(1)
.RS 4
help add structured information into commit messages\&.
.RE
.PP
\fBgit-mailinfo\fR(1)
.RS 4
Extracts patch and authorship from a single e\-mail message\&.
.RE
.PP
\fBgit-mailsplit\fR(1)
.RS 4
Simple UNIX mbox splitter program\&.
.RE
.PP
\fBgit-merge-one-file\fR(1)
.RS 4
The standard helper program to use with git\-merge\-index\&.
.RE
.PP
\fBgit-patch-id\fR(1)
.RS 4
Compute unique ID for a patch\&.
.RE
.PP
\fBgit-sh-i18n\fR(1)
.RS 4
Git\(cqs i18n setup code for shell scripts\&.
.RE
.PP
\fBgit-sh-setup\fR(1)
.RS 4
Common Git shell script setup code\&.
.RE
.PP
\fBgit-stripspace\fR(1)
.RS 4
Remove unnecessary whitespace\&.
.RE
.SH "CONFIGURATION MECHANISM"
.sp
Git uses a simple text format to store customizations that are per repository and are per user\&. Such a configuration file may look like this:
.sp
.if n \{\
.RS 4
.\}
.nf
#
# A \*(Aq#\*(Aq or \*(Aq;\*(Aq character indicates a comment\&.
#

; core variables
[core]
        ; Don\*(Aqt trust file modes
        filemode = false

; user identity
[user]
        name = "Junio C Hamano"
        email = "gitster@pobox\&.com"
.fi
.if n \{\
.RE
.\}
.sp
.sp
Various commands read from the configuration file and adjust their operation accordingly\&. See \fBgit-config\fR(1) for a list and more details about the configuration mechanism\&.
.SH "IDENTIFIER TERMINOLOGY"
.PP
<object>
.RS 4
Indicates the object name for any type of object\&.
.RE
.PP
<blob>
.RS 4
Indicates a blob object name\&.
.RE
.PP
<tree>
.RS 4
Indicates a tree object name\&.
.RE
.PP
<commit>
.RS 4
Indicates a commit object name\&.
.RE
.PP
<tree\-ish>
.RS 4
Indicates a tree, commit or tag object name\&. A command that takes a <tree\-ish> argument ultimately wants to operate on a <tree> object but automatically dereferences <commit> and <tag> objects that point at a <tree>\&.
.RE
.PP
<commit\-ish>
.RS 4
Indicates a commit or tag object name\&. A command that takes a <commit\-ish> argument ultimately wants to operate on a <commit> object but automatically dereferences <tag> objects that point at a <commit>\&.
.RE
.PP
<type>
.RS 4
Indicates that an object type is required\&. Currently one of:
\fBblob\fR,
\fBtree\fR,
\fBcommit\fR, or
\fBtag\fR\&.
.RE
.PP
<file>
.RS 4
Indicates a filename \- almost always relative to the root of the tree structure
\fBGIT_INDEX_FILE\fR
describes\&.
.RE
.SH "SYMBOLIC IDENTIFIERS"
.sp
Any Git command accepting any <object> can also use the following symbolic notation:
.PP
HEAD
.RS 4
indicates the head of the current branch\&.
.RE
.PP
<tag>
.RS 4
a valid tag
\fIname\fR
(i\&.e\&. a
\fBrefs/tags/<tag>\fR
reference)\&.
.RE
.PP
<head>
.RS 4
a valid head
\fIname\fR
(i\&.e\&. a
\fBrefs/heads/<head>\fR
reference)\&.
.RE
.sp
For a more complete list of ways to spell object names, see "SPECIFYING REVISIONS" section in \fBgitrevisions\fR(7)\&.
.SH "FILE/DIRECTORY STRUCTURE"
.sp
Please see the \fBgitrepository-layout\fR(5) document\&.
.sp
Read \fBgithooks\fR(5) for more details about each hook\&.
.sp
Higher level SCMs may provide and manage additional information in the \fB$GIT_DIR\fR\&.
.SH "TERMINOLOGY"
.sp
Please see \fBgitglossary\fR(7)\&.
.SH "ENVIRONMENT VARIABLES"
.sp
Various Git commands use the following environment variables:
.SS "The Git Repository"
.sp
These environment variables apply to \fIall\fR core Git commands\&. Nb: it is worth noting that they may be used/overridden by SCMS sitting above Git so take care if using Cogito etc\&.
.PP
\fIGIT_INDEX_FILE\fR
.RS 4
This environment allows the specification of an alternate index file\&. If not specified, the default of
\fB$GIT_DIR/index\fR
is used\&.
.RE
.PP
\fIGIT_INDEX_VERSION\fR
.RS 4
This environment variable allows the specification of an index version for new repositories\&. It won\(cqt affect existing index files\&. By default index file version 2 or 3 is used\&. See
\fBgit-update-index\fR(1)
for more information\&.
.RE
.PP
\fIGIT_OBJECT_DIRECTORY\fR
.RS 4
If the object storage directory is specified via this environment variable then the sha1 directories are created underneath \- otherwise the default
\fB$GIT_DIR/objects\fR
directory is used\&.
.RE
.PP
\fIGIT_ALTERNATE_OBJECT_DIRECTORIES\fR
.RS 4
Due to the immutable nature of Git objects, old objects can be archived into shared, read\-only directories\&. This variable specifies a ":" separated (on Windows ";" separated) list of Git object directories which can be used to search for Git objects\&. New objects will not be written to these directories\&.
.RE
.PP
\fIGIT_DIR\fR
.RS 4
If the
\fIGIT_DIR\fR
environment variable is set then it specifies a path to use instead of the default
\fB\&.git\fR
for the base of the repository\&. The
\fI\-\-git\-dir\fR
command\-line option also sets this value\&.
.RE
.PP
\fIGIT_WORK_TREE\fR
.RS 4
Set the path to the root of the working tree\&. This can also be controlled by the
\fI\-\-work\-tree\fR
command\-line option and the core\&.worktree configuration variable\&.
.RE
.PP
\fIGIT_NAMESPACE\fR
.RS 4
Set the Git namespace; see
\fBgitnamespaces\fR(7)
for details\&. The
\fI\-\-namespace\fR
command\-line option also sets this value\&.
.RE
.PP
\fIGIT_CEILING_DIRECTORIES\fR
.RS 4
This should be a colon\-separated list of absolute paths\&. If set, it is a list of directories that Git should not chdir up into while looking for a repository directory (useful for excluding slow\-loading network directories)\&. It will not exclude the current working directory or a GIT_DIR set on the command line or in the environment\&. Normally, Git has to read the entries in this list and resolve any symlink that might be present in order to compare them with the current directory\&. However, if even this access is slow, you can add an empty entry to the list to tell Git that the subsequent entries are not symlinks and needn\(cqt be resolved; e\&.g\&.,
\fIGIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink\fR\&.
.RE
.PP
\fIGIT_DISCOVERY_ACROSS_FILESYSTEM\fR
.RS 4
When run in a directory that does not have "\&.git" repository directory, Git tries to find such a directory in the parent directories to find the top of the working tree, but by default it does not cross filesystem boundaries\&. This environment variable can be set to true to tell Git not to stop at filesystem boundaries\&. Like
\fIGIT_CEILING_DIRECTORIES\fR, this will not affect an explicit repository directory set via
\fIGIT_DIR\fR
or on the command line\&.
.RE
.SS "Git Commits"
.PP
\fIGIT_AUTHOR_NAME\fR, \fIGIT_AUTHOR_EMAIL\fR, \fIGIT_AUTHOR_DATE\fR, \fIGIT_COMMITTER_NAME\fR, \fIGIT_COMMITTER_EMAIL\fR, \fIGIT_COMMITTER_DATE\fR, \fIEMAIL\fR
.RS 4
see
\fBgit-commit-tree\fR(1)
.RE
.SS "Git Diffs"
.PP
\fIGIT_DIFF_OPTS\fR
.RS 4
Only valid setting is "\-\-unified=??" or "\-u??" to set the number of context lines shown when a unified diff is created\&. This takes precedence over any "\-U" or "\-\-unified" option value passed on the Git diff command line\&.
.RE
.PP
\fIGIT_EXTERNAL_DIFF\fR
.RS 4
When the environment variable
\fIGIT_EXTERNAL_DIFF\fR
is set, the program named by it is called, instead of the diff invocation described above\&. For a path that is added, removed, or modified,
\fIGIT_EXTERNAL_DIFF\fR
is called with 7 parameters:
.sp
.if n \{\
.RS 4
.\}
.nf
path old\-file old\-hex old\-mode new\-file new\-hex new\-mode
.fi
.if n \{\
.RE
.\}
.sp
where:
.RE
.PP
<old|new>\-file
.RS 4
are files GIT_EXTERNAL_DIFF can use to read the contents of <old|new>,
.RE
.PP
<old|new>\-hex
.RS 4
are the 40\-hexdigit SHA\-1 hashes,
.RE
.PP
<old|new>\-mode
.RS 4
are the octal representation of the file modes\&.
.sp
The file parameters can point at the user\(cqs working file (e\&.g\&.
\fBnew\-file\fR
in "git\-diff\-files"),
\fB/dev/null\fR
(e\&.g\&.
\fBold\-file\fR
when a new file is added), or a temporary file (e\&.g\&.
\fBold\-file\fR
in the index)\&.
\fIGIT_EXTERNAL_DIFF\fR
should not worry about unlinking the temporary file \-\-\- it is removed when
\fIGIT_EXTERNAL_DIFF\fR
exits\&.
.sp
For a path that is unmerged,
\fIGIT_EXTERNAL_DIFF\fR
is called with 1 parameter, <path>\&.
.sp
For each path
\fIGIT_EXTERNAL_DIFF\fR
is called, two environment variables,
\fIGIT_DIFF_PATH_COUNTER\fR
and
\fIGIT_DIFF_PATH_TOTAL\fR
are set\&.
.RE
.PP
\fIGIT_DIFF_PATH_COUNTER\fR
.RS 4
A 1\-based counter incremented by one for every path\&.
.RE
.PP
\fIGIT_DIFF_PATH_TOTAL\fR
.RS 4
The total number of paths\&.
.RE
.SS "other"
.PP
\fIGIT_MERGE_VERBOSITY\fR
.RS 4
A number controlling the amount of output shown by the recursive merge strategy\&. Overrides merge\&.verbosity\&. See
\fBgit-merge\fR(1)
.RE
.PP
\fIGIT_PAGER\fR
.RS 4
This environment variable overrides
\fB$PAGER\fR\&. If it is set to an empty string or to the value "cat", Git will not launch a pager\&. See also the
\fBcore\&.pager\fR
option in
\fBgit-config\fR(1)\&.
.RE
.PP
\fIGIT_EDITOR\fR
.RS 4
This environment variable overrides
\fB$EDITOR\fR
and
\fB$VISUAL\fR\&. It is used by several Git commands when, on interactive mode, an editor is to be launched\&. See also
\fBgit-var\fR(1)
and the
\fBcore\&.editor\fR
option in
\fBgit-config\fR(1)\&.
.RE
.PP
\fIGIT_SSH\fR, \fIGIT_SSH_COMMAND\fR
.RS 4
If either of these environment variables is set then
\fIgit fetch\fR
and
\fIgit push\fR
will use the specified command instead of
\fIssh\fR
when they need to connect to a remote system\&. The command will be given exactly two or four arguments: the
\fIusername@host\fR
(or just
\fIhost\fR) from the URL and the shell command to execute on that remote system, optionally preceded by
\fI\-p\fR
(literally) and the
\fIport\fR
from the URL when it specifies something other than the default SSH port\&.
.sp
\fB$GIT_SSH_COMMAND\fR
takes precedence over
\fB$GIT_SSH\fR, and is interpreted by the shell, which allows additional arguments to be included\&.
\fB$GIT_SSH\fR
on the other hand must be just the path to a program (which can be a wrapper shell script, if additional arguments are needed)\&.
.sp
Usually it is easier to configure any desired options through your personal
\fB\&.ssh/config\fR
file\&. Please consult your ssh documentation for further details\&.
.RE
.PP
\fIGIT_ASKPASS\fR
.RS 4
If this environment variable is set, then Git commands which need to acquire passwords or passphrases (e\&.g\&. for HTTP or IMAP authentication) will call this program with a suitable prompt as command\-line argument and read the password from its STDOUT\&. See also the
\fIcore\&.askpass\fR
option in
\fBgit-config\fR(1)\&.
.RE
.PP
\fIGIT_TERMINAL_PROMPT\fR
.RS 4
If this environment variable is set to
\fB0\fR, git will not prompt on the terminal (e\&.g\&., when asking for HTTP authentication)\&.
.RE
.PP
\fIGIT_CONFIG_NOSYSTEM\fR
.RS 4
Whether to skip reading settings from the system\-wide
\fB$(prefix)/etc/gitconfig\fR
file\&. This environment variable can be used along with
\fB$HOME\fR
and
\fB$XDG_CONFIG_HOME\fR
to create a predictable environment for a picky script, or you can set it temporarily to avoid using a buggy
\fB/etc/gitconfig\fR
file while waiting for someone with sufficient permissions to fix it\&.
.RE
.PP
\fIGIT_FLUSH\fR
.RS 4
If this environment variable is set to "1", then commands such as
\fIgit blame\fR
(in incremental mode),
\fIgit rev\-list\fR,
\fIgit log\fR,
\fIgit check\-attr\fR
and
\fIgit check\-ignore\fR
will force a flush of the output stream after each record have been flushed\&. If this variable is set to "0", the output of these commands will be done using completely buffered I/O\&. If this environment variable is not set, Git will choose buffered or record\-oriented flushing based on whether stdout appears to be redirected to a file or not\&.
.RE
.PP
\fIGIT_TRACE\fR
.RS 4
Enables general trace messages, e\&.g\&. alias expansion, built\-in command execution and external command execution\&.
.sp
If this variable is set to "1", "2" or "true" (comparison is case insensitive), trace messages will be printed to stderr\&.
.sp
If the variable is set to an integer value greater than 2 and lower than 10 (strictly) then Git will interpret this value as an open file descriptor and will try to write the trace messages into this file descriptor\&.
.sp
Alternatively, if the variable is set to an absolute path (starting with a
\fI/\fR
character), Git will interpret this as a file path and will try to write the trace messages into it\&.
.sp
Unsetting the variable, or setting it to empty, "0" or "false" (case insensitive) disables trace messages\&.
.RE
.PP
\fIGIT_TRACE_PACK_ACCESS\fR
.RS 4
Enables trace messages for all accesses to any packs\&. For each access, the pack file name and an offset in the pack is recorded\&. This may be helpful for troubleshooting some pack\-related performance problems\&. See
\fIGIT_TRACE\fR
for available trace output options\&.
.RE
.PP
\fIGIT_TRACE_PACKET\fR
.RS 4
Enables trace messages for all packets coming in or out of a given program\&. This can help with debugging object negotiation or other protocol issues\&. Tracing is turned off at a packet starting with "PACK"\&. See
\fIGIT_TRACE\fR
for available trace output options\&.
.RE
.PP
\fIGIT_TRACE_PERFORMANCE\fR
.RS 4
Enables performance related trace messages, e\&.g\&. total execution time of each Git command\&. See
\fIGIT_TRACE\fR
for available trace output options\&.
.RE
.PP
\fIGIT_TRACE_SETUP\fR
.RS 4
Enables trace messages printing the \&.git, working tree and current working directory after Git has completed its setup phase\&. See
\fIGIT_TRACE\fR
for available trace output options\&.
.RE
.PP
\fIGIT_TRACE_SHALLOW\fR
.RS 4
Enables trace messages that can help debugging fetching / cloning of shallow repositories\&. See
\fIGIT_TRACE\fR
for available trace output options\&.
.RE
.PP
GIT_LITERAL_PATHSPECS
.RS 4
Setting this variable to
\fB1\fR
will cause Git to treat all pathspecs literally, rather than as glob patterns\&. For example, running
\fBGIT_LITERAL_PATHSPECS=1 git log \-\- \*(Aq*\&.c\*(Aq\fR
will search for commits that touch the path
\fB*\&.c\fR, not any paths that the glob
\fB*\&.c\fR
matches\&. You might want this if you are feeding literal paths to Git (e\&.g\&., paths previously given to you by
\fBgit ls\-tree\fR,
\fB\-\-raw\fR
diff output, etc)\&.
.RE
.PP
GIT_GLOB_PATHSPECS
.RS 4
Setting this variable to
\fB1\fR
will cause Git to treat all pathspecs as glob patterns (aka "glob" magic)\&.
.RE
.PP
GIT_NOGLOB_PATHSPECS
.RS 4
Setting this variable to
\fB1\fR
will cause Git to treat all pathspecs as literal (aka "literal" magic)\&.
.RE
.PP
GIT_ICASE_PATHSPECS
.RS 4
Setting this variable to
\fB1\fR
will cause Git to treat all pathspecs as case\-insensitive\&.
.RE
.PP
\fIGIT_REFLOG_ACTION\fR
.RS 4
When a ref is updated, reflog entries are created to keep track of the reason why the ref was updated (which is typically the name of the high\-level command that updated the ref), in addition to the old and new values of the ref\&. A scripted Porcelain command can use set_reflog_action helper function in
\fBgit\-sh\-setup\fR
to set its name to this variable when it is invoked as the top level command by the end user, to be recorded in the body of the reflog\&.
.RE
.PP
\fBGIT_REF_PARANOIA\fR
.RS 4
If set to
\fB1\fR, include broken or badly named refs when iterating over lists of refs\&. In a normal, non\-corrupted repository, this does nothing\&. However, enabling it may help git to detect and abort some operations in the presence of broken refs\&. Git sets this variable automatically when performing destructive operations like
\fBgit-prune\fR(1)\&. You should not need to set it yourself unless you want to be paranoid about making sure an operation has touched every ref (e\&.g\&., because you are cloning a repository to make a backup)\&.
.RE
.SH "DISCUSSION"
.sp
More detail on the following is available from the \m[blue]\fBGit concepts chapter of the user\-manual\fR\m[]\&\s-2\u[2]\d\s+2 and \fBgitcore-tutorial\fR(7)\&.
.sp
A Git project normally consists of a working directory with a "\&.git" subdirectory at the top level\&. The \&.git directory contains, among other things, a compressed object database representing the complete history of the project, an "index" file which links that history to the current contents of the working tree, and named pointers into that history such as tags and branch heads\&.
.sp
The object database contains objects of three main types: blobs, which hold file data; trees, which point to blobs and other trees to build up directory hierarchies; and commits, which each reference a single tree and some number of parent commits\&.
.sp
The commit, equivalent to what other systems call a "changeset" or "version", represents a step in the project\(cqs history, and each parent represents an immediately preceding step\&. Commits with more than one parent represent merges of independent lines of development\&.
.sp
All objects are named by the SHA\-1 hash of their contents, normally written as a string of 40 hex digits\&. Such names are globally unique\&. The entire history leading up to a commit can be vouched for by signing just that commit\&. A fourth object type, the tag, is provided for this purpose\&.
.sp
When first created, objects are stored in individual files, but for efficiency may later be compressed together into "pack files"\&.
.sp
Named pointers called refs mark interesting points in history\&. A ref may contain the SHA\-1 name of an object or the name of another ref\&. Refs with names beginning \fBref/head/\fR contain the SHA\-1 name of the most recent commit (or "head") of a branch under development\&. SHA\-1 names of tags of interest are stored under \fBref/tags/\fR\&. A special ref named \fBHEAD\fR contains the name of the currently checked\-out branch\&.
.sp
The index file is initialized with a list of all paths and, for each path, a blob object and a set of attributes\&. The blob object represents the contents of the file as of the head of the current branch\&. The attributes (last modified time, size, etc\&.) are taken from the corresponding file in the working tree\&. Subsequent changes to the working tree can be found by comparing these attributes\&. The index may be updated with new content, and new commits may be created from the content stored in the index\&.
.sp
The index is also capable of storing multiple entries (called "stages") for a given pathname\&. These stages are used to hold the various unmerged version of a file when a merge is in progress\&.
.SH "FURTHER DOCUMENTATION"
.sp
See the references in the "description" section to get started using Git\&. The following is probably more detail than necessary for a first\-time user\&.
.sp
The \m[blue]\fBGit concepts chapter of the user\-manual\fR\m[]\&\s-2\u[2]\d\s+2 and \fBgitcore-tutorial\fR(7) both provide introductions to the underlying Git architecture\&.
.sp
See \fBgitworkflows\fR(7) for an overview of recommended workflows\&.
.sp
See also the \m[blue]\fBhowto\fR\m[]\&\s-2\u[3]\d\s+2 documents for some useful examples\&.
.sp
The internals are documented in the \m[blue]\fBGit API documentation\fR\m[]\&\s-2\u[4]\d\s+2\&.
.sp
Users migrating from CVS may also want to read \fBgitcvs-migration\fR(7)\&.
.SH "作者 (AUTHORS)"
.sp
Git 项目由 Linus Torvalds 发起, 目前由 Junio C Hamano 维护。
Numerous contributions have come from the Git mailing list <\m[blue]\fBgit@vger\&.kernel\&.org\fR\m[]\&\s-2\u[5]\d\s+2>\&. \m[blue]\fBhttp://www\&.openhub\&.net/p/git/contributors/summary\fR\m[] gives you a more complete list of contributors\&.
.sp
If you have a clone of git\&.git itself, the output of \fBgit-shortlog\fR(1) and \fBgit-blame\fR(1) can show you the authors for specific parts of the project\&.
.SH "反馈BUG (REPORTING BUGS)"
.sp
请在 Git 邮件列表 <\m[blue]\fBgit@vger\&.kernel\&.org\fR\m[]\&\s-2\u[5]\d\s+2> 反馈Bug, Git 的开发与维护主要在这里完成。
你无需订阅邮件列表即可向其发送邮件。
.SH "参见 (SEE ALSO)"
.sp
\fBgittutorial\fR(7), \fBgittutorial-2\fR(7), \fBgiteveryday\fR(7), \fBgitcvs-migration\fR(7), \fBgitglossary\fR(7), \fBgitcore-tutorial\fR(7), \fBgitcli\fR(7), \m[blue]\fBThe Git User\(cqs Manual\fR\m[]\&\s-2\u[1]\d\s+2, \fBgitworkflows\fR(7)
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite
.SH "NOTES"
.IP " 1." 4
Git User\(cqs Manual
.RS 4
\%file:///usr/share/doc/git-doc/user-manual.html
.RE
.IP " 2." 4
Git concepts chapter of the user-manual
.RS 4
\%file:///usr/share/doc/git-doc/user-manual.html#git-concepts
.RE
.IP " 3." 4
howto
.RS 4
\%file:///usr/share/doc/git-doc/howto-index.html
.RE
.IP " 4." 4
Git API documentation
.RS 4
\%file:///usr/share/doc/git-doc/technical/api-index.html
.RE
.IP " 5." 4
git@vger.kernel.org
.RS 4
\%mailto:git@vger.kernel.org
.RE
.SH "版权所有 (COPYRIGHT)"
.PP
本文档的非正式中文翻译由 manpages_zh 项目提供。
